package sh.grapendaal.tsuushin.module.uno.engine.domain.achievement.impl;

import sh.grapendaal.tsuushin.module.uno.engine.UnoRules;
import sh.grapendaal.tsuushin.module.uno.engine.domain.Card.Rank;
import sh.grapendaal.tsuushin.module.uno.engine.domain.achievement.Achievement;
import sh.grapendaal.tsuushin.module.uno.engine.dto.GameState;

public class OhNoYouDontAchievement extends Achievement {

	@Override
	public String getName() {
		return "Oh No You Don’t";
	}

	@Override
	public String getDescription() {
		return "Play a Draw 2 or WD4 when the next player has Uno.";
	}

	@Override
	public boolean isEarned(GameState gameState) {
		return UnoRules.hasUno(gameState.getNextPlayer().getCards())
				&& (gameState.getPlayed().getRank() == Rank.DRAW_TWO || gameState.getPlayed().getRank() == Rank.DRAW_FOUR);
	}

}
